load("@rules_python//python:defs.bzl", "py_test")
load("@pip_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

filegroup(
    name = "test_lib",
    srcs = [
        "test_util.sh",
    ],
)

sh_test(
    name = "keyset_reader_writer_test",
    size = "small",
    srcs = [
        "keyset_reader_writer_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing/cc:keyset_reader_writer_cli",
        "//tinkey",
    ],
)

sh_test(
    name = "version_test",
    size = "medium",
    srcs = [
        "version_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:version_cli_java",
        "//testing/cc:version_cli_cc",
        "@tink_base//:tink_version",
    ],
)

sh_test(
    name = "aead_test_sh",
    size = "medium",
    srcs = [
        "aead_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:aead_cli_java",
        "//testing/cc:aead_cli_cc",
        "//testing/go:aead_cli_go",
        "//testing/python:aead_cli_python",
        "//tinkey",
        "@tink_base//testdata:credentials",
    ],
)

py_test(
    name = "aead_test",
    srcs = ["aead_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [
        requirement("absl-py"),
        "//testing/cross_language/util:cli_aead",
        "//testing/cross_language/util:cli_tinkey",
        "@tink_py//tink:tink_python",
        "@tink_py//tink/aead",
    ],
)

sh_test(
    name = "aead_envelope_test",
    size = "medium",
    srcs = [
        "aead_envelope_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:aead_cli_java",
        "//testing/cc:aead_cli_cc",
        "//testing/go:aead_cli_go",
        "//testing/go:generate_envelope_keyset",
        "//tinkey",
        "@google_root_pem//file",
        "@tink_base//testdata:credentials",
    ],
    tags = ["no_rbe"],
)

sh_test(
    name = "deterministic_aead_test_sh",
    size = "medium",
    srcs = [
        "deterministic_aead_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:deterministic_aead_cli_java",
        "//testing/cc:deterministic_aead_cli_cc",
        "//testing/go:deterministic_aead_cli_go",
        "//testing/python:deterministic_aead_cli_python",
        "//tinkey",
    ],
)

py_test(
    name = "deterministic_aead_test",
    srcs = ["deterministic_aead_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [
        requirement("absl-py"),
        "//testing/cross_language/util:cli_daead",
        "//testing/cross_language/util:cli_tinkey",
        "@tink_py//tink:tink_python",
        "@tink_py//tink/daead",
    ],
)

sh_test(
    name = "streaming_aead_test",
    size = "medium",
    srcs = [
        "streaming_aead_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:streaming_aead_cli_java",
        "//testing/cc:streaming_aead_cli_cc",
        "//testing/go:streaming_aead_cli_go",
        "//tinkey",
    ],
)

sh_test(
    name = "mac_test_sh",
    size = "medium",
    srcs = [
        "mac_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:mac_cli_java",
        "//testing/cc:mac_cli_cc",
        "//testing/go:mac_cli_go",
        "//testing/python:mac_cli_python",
        "//tinkey",
    ],
)

py_test(
    name = "mac_test",
    srcs = ["mac_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [
        requirement("absl-py"),
        "//testing/cross_language/util:cli_mac",
        "//testing/cross_language/util:cli_tinkey",
        "@tink_py//tink:tink_python",
        "@tink_py//tink/mac",
    ],
)

sh_test(
    name = "prf_set_test",
    size = "medium",
    srcs = [
        "prf_set_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing/cc:prf_set_cli_cc",
        "//testing/go:prf_set_cli_go",
        "//tinkey",
    ],
)

sh_test(
    name = "hybrid_encryption_test_sh",
    size = "medium",
    srcs = [
        "hybrid_encryption_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:hybrid_decrypt_cli_java",
        "//testing:hybrid_encrypt_cli_java",
        "//testing/cc:hybrid_decrypt_cli_cc",
        "//testing/cc:hybrid_encrypt_cli_cc",
        "//testing/go:hybrid_decrypt_cli_go",
        "//testing/go:hybrid_encrypt_cli_go",
        "//testing/python:hybrid_decrypt_cli_python",
        "//testing/python:hybrid_encrypt_cli_python",
        "//tinkey",
    ],
)

py_test(
    name = "hybrid_encryption_test",
    srcs = ["hybrid_encryption_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [
        requirement("absl-py"),
        "//testing/cross_language/util:cli_hybrid",
        "//testing/cross_language/util:cli_tinkey",
        "@tink_py//tink:tink_python",
        "@tink_py//tink/hybrid",
    ],
)

sh_test(
    name = "signature_test_sh",
    size = "large",
    timeout = "long",
    srcs = [
        "signature_test.sh",
    ],
    data = [
        ":test_lib",
        "//testing:public_key_sign_cli_java",
        "//testing:public_key_verify_cli_java",
        "//testing/cc:public_key_sign_cli_cc",
        "//testing/cc:public_key_verify_cli_cc",
        "//testing/go:public_key_sign_cli_go",
        "//testing/go:public_key_verify_cli_go",
        "//testing/python:public_key_sign_cli_python",
        "//testing/python:public_key_verify_cli_python",
        "//tinkey",
    ],
)

py_test(
    name = "signature_test",
    srcs = ["signature_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [
        requirement("absl-py"),
        "//testing/cross_language/util:cli_signature",
        "//testing/cross_language/util:cli_tinkey",
        "@tink_py//tink:tink_python",
        "@tink_py//tink/signature",
    ],
)
